<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="DUDU的博客">
    <meta name="keyword"  content="博客,blog,技术博客,编程,前端">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        svn 常用操作命令 - DUDU的博客
        
    </title>

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/aircloud.css">
    <link rel="stylesheet" href="/css/gitment.css">
    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_pl6z7sid89qkt9.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>
</head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i> 灵感来源于总结，成长来源于分享 </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar">
            <img src="/img/avatar.jpg" />
        </div>
        <div class="name">
            <i>Du Heng</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archive">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
            <li>
                <a id="search">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>搜索</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#svn-常用操作命令"><span class="toc-text">svn 常用操作命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-检出"><span class="toc-text">1 检出</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子："><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-导出-导出一个干净的不带-svn文件夹的目录树"><span class="toc-text">2 导出(导出一个干净的不带.svn文件夹的目录树)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-1"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-添加新文件"><span class="toc-text">3 添加新文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-提交"><span class="toc-text">4 提交</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-2"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-更新文件"><span class="toc-text">5 更新文件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-3"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-删除文件"><span class="toc-text">6 删除文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-加锁-解锁"><span class="toc-text">7 加锁/解锁</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-4"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-比较差异"><span class="toc-text">8 比较差异</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-5"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#9-查看文件或者目录状态"><span class="toc-text">9 查看文件或者目录状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-查看日志"><span class="toc-text">10 查看日志</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-6"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-查看文件详细信息"><span class="toc-text">11 查看文件详细信息</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-7"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-SVN-帮助"><span class="toc-text">12 SVN 帮助</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13-查看版本库下的文件和目录列表"><span class="toc-text">13 查看版本库下的文件和目录列表</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-8"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#14-创建纳入版本控制下的新目录"><span class="toc-text">14 创建纳入版本控制下的新目录</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-9"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#15-svn-update"><span class="toc-text">15 svn update</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-恢复本地修改"><span class="toc-text">16 恢复本地修改</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-10"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-把工作拷贝更新到别的URL"><span class="toc-text">17 把工作拷贝更新到别的URL</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-11"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18-解决冲突-（冲突可以手动合并的情况）"><span class="toc-text">18 解决冲突 （冲突可以手动合并的情况）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-12"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#19-不checkout而查看输出特定文件或URL的内容"><span class="toc-text">19 不checkout而查看输出特定文件或URL的内容</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#例子：-13"><span class="toc-text">例子：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#20-新建一个分支copy"><span class="toc-text">20 新建一个分支copy</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-合并内容到分支merge"><span class="toc-text">21 合并内容到分支merge</span></a></li></ol></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>
        <div class="index-about-mobile">
            <i> 灵感来源于总结，成长来源于分享 </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        svn 常用操作命令
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2018-06-10 13:04:02</span></span>
        
        <span class="attr">标签：/
        
        <a class="tag" href="/tags/#svn" title="svn">svn</a>
        <span>/</span>
        
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content ">
        <p>欢迎来到我的个人技术博客！</p>
<h2 id="svn-常用操作命令"><a href="#svn-常用操作命令" class="headerlink" title="svn 常用操作命令"></a>svn 常用操作命令</h2><h3 id="1-检出"><a href="#1-检出" class="headerlink" title="1 检出"></a>1 检出</h3><figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn  checkout （类似git clone）  <span class="string">http:</span><span class="comment">//路径(目录或文件的全路径)　[本地目录全路径] --username　用户名</span></span><br><span class="line">svn  checkout  <span class="string">svn:</span><span class="comment">//路径(目录或文件的全路径)　[本地目录全路径]  --username　用户名</span></span><br></pre></td></tr></table></figure>
<h4 id="例子："><a href="#例子：" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">svn co svn:<span class="string">//localhost/</span>测试工具 <span class="string">/home/testtools</span> <span class="params">--username</span> wzhnsc</span><br><span class="line">svn co http:<span class="string">//localhost/test/testapp</span> <span class="params">--username</span> wzhnsc</span><br><span class="line">svn checkout svn:<span class="string">//localhost/</span>测试工具 <span class="string">/home/testtools</span> <span class="params">--username</span> wzhnsc</span><br><span class="line">svn checkouthttp:<span class="string">//localhost/test/testapp</span> <span class="params">--username</span> wzhnsc</span><br></pre></td></tr></table></figure>
<p>注：如果不带–password 参数传输密码的话，会提示输入密码，建议不要用明文的–password 选项。<br>　　 其中 username 与 password前是两个短线，不是一个。<br>　　 不指定本地目录全路径，则检出到当前目录下。</p>
<h3 id="2-导出-导出一个干净的不带-svn文件夹的目录树"><a href="#2-导出-导出一个干净的不带-svn文件夹的目录树" class="headerlink" title="2 导出(导出一个干净的不带.svn文件夹的目录树)"></a>2 导出(导出一个干净的不带.svn文件夹的目录树)</h3><figure class="highlight elm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="title">svn</span>  ex<span class="keyword">port</span>  [-r 版本号]  http://路径(目录或文件的全路径) [本地目录全路径]　<span class="comment">--username　用户名</span></span><br><span class="line">svn  export  [-r 版本号]  svn://路径(目录或文件的全路径) [本地目录全路径]　<span class="comment">--username　用户名</span></span><br><span class="line">svn  export  本地检出的(即带有.svn文件夹的)目录全路径  要导出的本地目录全路径</span><br></pre></td></tr></table></figure>
<h4 id="例子：-1"><a href="#例子：-1" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight arduino"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">svn <span class="keyword">export</span> svn:<span class="comment">//localhost/测试工具 /home/testtools --username wzhnsc</span></span><br><span class="line">svn <span class="keyword">export</span> svn:<span class="comment">//localhost/test/testapp --username wzhnsc</span></span><br><span class="line">svn <span class="keyword">export</span> /<span class="built_in">home</span>/testapp /<span class="built_in">home</span>/testtools</span><br></pre></td></tr></table></figure>
<p>注：第一种从版本库导出干净工作目录树的形式是指定URL，如果指定了修订版本号，会导出相应的版本，如果没有指定修订版本，则会导出最新的，导出到指定位置。如果省略 本地目录全路径，URL的最后一部分会作为本地目录的名字。第二种形式是指定 本地检出的目录全路径 到 要导出的本地目录全路径，所有的本地修改将会保留，但是不在版本控制下(即没提交的新文件，因为.svn文件夹里没有与之相关的信息记录)的文件不会拷贝。</p><p>二者区别：check out导出获得文件后，导出的文件仍处于SVN版本控制中，与版本库保持关联，比如你可以进行Svn Update或者Svn Commit操作。同时导出文件夹下有一个.svn的隐藏文件夹，存储着一些版本的元数据信息。<br>export 简单导出一个版本的数据，导出的文件脱离SVN版本控制，修改后无进行Update和Commit操作。导出文件夹下没有.svn目录</p>


<h3 id="3-添加新文件"><a href="#3-添加新文件" class="headerlink" title="3 添加新文件"></a>3 添加新文件</h3><figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">add</span><span class="bash">　文件名</span></span><br><span class="line"><span class="bash">注：告诉SVN服务器要添加文件了，还要用svn commint -m真实的上传上去！</span></span><br><span class="line"><span class="bash"><span class="comment">#### 例子：</span></span></span><br><span class="line"><span class="bash">svn add test.php ＜－ 添加test.php </span></span><br><span class="line"><span class="bash">svn commit -m “添加我的测试用test.php“ test.php</span></span><br><span class="line"><span class="bash">svn add *.php ＜－ 添加当前目录下所有的php文件</span></span><br><span class="line"><span class="bash">svn commit -m <span class="string">'添加我的测试用全部php文件'</span> *.php</span></span><br></pre></td></tr></table></figure>
<h3 id="4-提交"><a href="#4-提交" class="headerlink" title="4 提交"></a>4 提交</h3><figure class="highlight accesslog"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">svn　commit　-m　“提交备注信息文本“　<span class="string">[-N]</span>　<span class="string">[--no-unlock]</span>　文件名</span><br><span class="line">svn　ci　-m　“提交备注信息文本“　<span class="string">[-N]</span>　<span class="string">[--no-unlock]</span>　文件名</span><br><span class="line">必须带上-m参数，参数可以为空，但是必须写上-m</span><br></pre></td></tr></table></figure>
<h4 id="例子：-2"><a href="#例子：-2" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">svn commit -<span class="keyword">m</span> “提交当前目录下的全部在版本控制下的文件“ * ＜－ 注意这个*表示全部文件</span><br><span class="line">svn commit -<span class="keyword">m</span> “提交我的测试用<span class="keyword">test</span>.php“ <span class="keyword">test</span>.php</span><br><span class="line">svn commit -<span class="keyword">m</span> “提交我的测试用<span class="keyword">test</span>.php“ -<span class="keyword">N</span> --<span class="keyword">no</span>-unlock <span class="keyword">test</span>.php ＜－ 保持锁就用–<span class="keyword">no</span>-unlock开关</span><br><span class="line">svn <span class="keyword">ci</span> -<span class="keyword">m</span> “提交当前目录下的全部在版本控制下的文件“ * ＜－ 注意这个*表示全部文件</span><br><span class="line">svn <span class="keyword">ci</span> -<span class="keyword">m</span> “提交我的测试用<span class="keyword">test</span>.php“ <span class="keyword">test</span>.php</span><br><span class="line">svn <span class="keyword">ci</span> -<span class="keyword">m</span> “提交我的测试用<span class="keyword">test</span>.php“ -<span class="keyword">N</span> --<span class="keyword">no</span>-unlock <span class="keyword">test</span>.php ＜－ 保持锁就用–<span class="keyword">no</span>-unlock开关</span><br></pre></td></tr></table></figure>
<h3 id="5-更新文件"><a href="#5-更新文件" class="headerlink" title="5 更新文件"></a>5 更新文件</h3><figure class="highlight n1ql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">update</span></span><br><span class="line">svn　<span class="keyword">update</span>　-r　修正版本　文件名</span><br><span class="line">svn　<span class="keyword">update</span>　文件名</span><br></pre></td></tr></table></figure>
<h4 id="例子：-3"><a href="#例子：-3" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">svn <span class="keyword">update</span> &lt;后面没有目录，默认将当前目录以及子目录下的所有文件都更新到最新版本&gt;</span><br><span class="line">svn <span class="keyword">update</span> -r 200 <span class="keyword">test</span>.cpp &lt;将版本库中的文件 <span class="keyword">test</span>.cpp 还原到修正版本（revision）200&gt;</span><br><span class="line">svn <span class="keyword">update</span> <span class="keyword">test</span>.php &lt;更新与版本库同步。提交的时候提示过期冲突，需要先 <span class="keyword">update</span> 修改文件，然后清除svn resolved，最后再提交commit。&gt;</span><br></pre></td></tr></table></figure>
<h3 id="6-删除文件"><a href="#6-删除文件" class="headerlink" title="6 删除文件"></a>6 删除文件</h3><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">delete</span>　svn:<span class="regexp">//</span>路径(目录或文件的全路径) -m “删除备注信息文本”</span><br><span class="line">推荐如下操作：</span><br><span class="line">svn　<span class="keyword">delete</span>　文件名 </span><br><span class="line">svn　ci　-m　“删除备注信息文本”</span><br><span class="line"><span class="comment"># 例子：</span></span><br><span class="line">svn <span class="keyword">delete</span> svn:<span class="regexp">//</span>localhost<span class="regexp">/testapp/</span>test.php -m “删除测试文件test.php”</span><br><span class="line">推荐如下操作：</span><br><span class="line">svn <span class="keyword">delete</span> test.php </span><br><span class="line">svn ci -m “删除测试文件test.php”</span><br></pre></td></tr></table></figure>
<h3 id="7-加锁-解锁"><a href="#7-加锁-解锁" class="headerlink" title="7 加锁/解锁"></a>7 加锁/解锁</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">lock</span>　-m　“加锁备注信息文本“　[<span class="comment">--force]　文件名 </span></span><br><span class="line">svn　<span class="keyword">unlock</span>　文件名</span><br></pre></td></tr></table></figure>
<h4 id="例子：-4"><a href="#例子：-4" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight x86asm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn <span class="keyword">lock</span> -m “锁信测试用<span class="keyword">test</span>.php文件“ <span class="keyword">test</span>.php </span><br><span class="line">svn unlock <span class="keyword">test</span>.php</span><br></pre></td></tr></table></figure>
<h3 id="8-比较差异"><a href="#8-比较差异" class="headerlink" title="8 比较差异"></a>8 比较差异</h3><figure class="highlight maxima"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="built_in">diff</span>　文件名 </span><br><span class="line">svn　<span class="built_in">diff</span>　-r　修正版本号m:修正版本号n　文件名</span><br></pre></td></tr></table></figure>
<h4 id="例子：-5"><a href="#例子：-5" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">svn</span> <span class="selector-tag">diff</span> <span class="selector-tag">test</span><span class="selector-class">.php</span>＜－ 将修改的文件与基础版本比较</span><br><span class="line"><span class="selector-tag">svn</span> <span class="selector-tag">diff</span> <span class="selector-tag">-r</span> 200<span class="selector-pseudo">:201</span> <span class="selector-tag">test</span><span class="selector-class">.php</span>＜－ 对 修正版本号200 和 修正版本号201 比较差异</span><br></pre></td></tr></table></figure>
<h3 id="9-查看文件或者目录状态"><a href="#9-查看文件或者目录状态" class="headerlink" title="9 查看文件或者目录状态"></a>9 查看文件或者目录状态</h3><figure class="highlight maxima"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">svn st 目录路径/名</span><br><span class="line">svn <span class="built_in">status</span> 目录路径/名 &lt;目录下的文件和子目录的状态，正常状态不显示 </span><br><span class="line">　　　　　　　　　　　　　【?：不在svn的控制中；  M：内容被修改；C：发生冲突；</span><br><span class="line">　　　　　　　　　　　　　　A：预定加入到版本库；K：被锁定】 &gt;</span><br><span class="line">svn  -v 目录路径/名</span><br><span class="line">svn <span class="built_in">status</span> -v 目录路径/名 &lt;显示文件和子目录状态</span><br><span class="line">　　　　　　　　　　　　　　【第一列保持相同，第二列显示工作版本号，</span><br><span class="line">　　　　　　　　　　　　　　 第三和第四列显示最后一次修改的版本号和修改人】&gt; </span><br><span class="line">//注：svn <span class="built_in">status</span>、svn <span class="built_in">diff</span>和 svn <span class="built_in">revert</span>这三条命令在没有网络的情况下也可以执行的，</span><br><span class="line">　　原因是svn在本地的.svn中保留了本地版本的原始拷贝。</span><br></pre></td></tr></table></figure>
<h3 id="10-查看日志"><a href="#10-查看日志" class="headerlink" title="10 查看日志"></a>10 查看日志</h3><figure class="highlight 1c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="built_in">log</span>　文件名</span><br></pre></td></tr></table></figure>
<h4 id="例子：-6"><a href="#例子：-6" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn <span class="keyword">log</span> <span class="keyword">test</span>.php＜－ 显示这个文件的所有修改记录，及其版本号的变化</span><br></pre></td></tr></table></figure>
<h3 id="11-查看文件详细信息"><a href="#11-查看文件详细信息" class="headerlink" title="11 查看文件详细信息"></a>11 查看文件详细信息</h3><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">svn</span>　<span class="literal">info</span>　文件名</span><br></pre></td></tr></table></figure>
<h4 id="例子：-7"><a href="#例子：-7" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">svn</span> <span class="literal">info</span> test.php</span><br></pre></td></tr></table></figure>
<h3 id="12-SVN-帮助"><a href="#12-SVN-帮助" class="headerlink" title="12 SVN 帮助"></a>12 SVN 帮助</h3><figure class="highlight stata"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">help</span>   全部功能选项</span><br><span class="line">svn　<span class="keyword">help</span>　<span class="keyword">ci</span>  具体功能的说明</span><br></pre></td></tr></table></figure>
<h3 id="13-查看版本库下的文件和目录列表"><a href="#13-查看版本库下的文件和目录列表" class="headerlink" title="13 查看版本库下的文件和目录列表"></a>13 查看版本库下的文件和目录列表</h3><figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　list　<span class="string">svn:</span><span class="comment">//路径(目录或文件的全路径)</span></span><br><span class="line">svn　ls　<span class="string">svn:</span><span class="comment">//路径(目录或文件的全路径)</span></span><br></pre></td></tr></table></figure>
<h4 id="例子：-8"><a href="#例子：-8" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn list <span class="string">svn:</span><span class="comment">//localhost/test</span></span><br><span class="line">svn ls <span class="string">svn:</span><span class="comment">//localhost/test &lt;显示svn://localhost/test目录下的所有属于版本库的文件和目录</span></span><br></pre></td></tr></table></figure>
<h3 id="14-创建纳入版本控制下的新目录"><a href="#14-创建纳入版本控制下的新目录" class="headerlink" title="14 创建纳入版本控制下的新目录"></a>14 创建纳入版本控制下的新目录</h3><figure class="highlight arduino"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="built_in">mkdir</span>　目录名</span><br><span class="line">svn　<span class="built_in">mkdir</span>　-m　<span class="string">"新增目录备注文本"</span>　http:<span class="comment">//目录全路径</span></span><br></pre></td></tr></table></figure>
<h4 id="例子：-9"><a href="#例子：-9" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight haxe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">svn mkdir <span class="keyword">new</span><span class="type">dir</span></span><br><span class="line"><span class="type">svn</span> mkdir -m <span class="string">"Making a new dir."</span> svn:<span class="type"></span>//localhost/test/<span class="keyword">new</span><span class="type">dir</span> </span><br><span class="line"><span class="comment">//注：添加完子目录后，一定要回到根目录更新一下，不然在该目录下提交文件会提示“提交失败”</span></span><br></pre></td></tr></table></figure>
<h3 id="15-svn-update"><a href="#15-svn-update" class="headerlink" title="15 svn update"></a>15 svn update</h3><figure class="highlight haxe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">注：如果手工在checkout出来的目录里创建了一个新文件夹<span class="keyword">new</span><span class="type">subdir</span>，</span><br><span class="line">　　再用svn mkdir <span class="keyword">new</span><span class="type">subdir</span>命令后，SVN会提示：</span><br><span class="line">　　svn: <span class="type"></span>尝试用 “svn add”或 “svn add --non-recursive”代替？</span><br><span class="line">　　svn: <span class="type"></span>无法创建目录“hello”: <span class="type"></span>文件已经存在</span><br><span class="line">　　此时，用如下命令解决：</span><br><span class="line">　　svn add --non-recursive <span class="keyword">new</span><span class="type">subdir</span></span><br><span class="line"><span class="type"></span>　　在进入这个<span class="keyword">new</span><span class="type">subdir</span>文件夹，用ls -a查看它下面的全部目录与文件，会发现多了：.svn目录</span><br><span class="line">　　再用 svn mkdir -m <span class="string">"添hello功能模块文件"</span> svn:<span class="type"></span>//localhost/test/<span class="keyword">new</span><span class="type">dir</span>/<span class="keyword">new</span><span class="type">subdir</span> 命令，</span><br><span class="line">　　SVN提示：</span><br><span class="line">　　svn: <span class="type">File already exists</span>: filesystem <span class="string">'/data/svnroot/test/db'</span>, transaction <span class="string">'4541-1'</span>,</span><br><span class="line">　　path <span class="string">'/newdir/newsubdir '</span></span><br></pre></td></tr></table></figure>
<h3 id="16-恢复本地修改"><a href="#16-恢复本地修改" class="headerlink" title="16 恢复本地修改"></a>16 恢复本地修改</h3><figure class="highlight jboss-cli"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">svn　revert　[<span class="params">--recursive</span>]　文件名</span><br><span class="line"><span class="string">//</span>注意: 本子命令不会存取网络，并且会解除冲突的状况。但是它不会恢复被删除的目录。</span><br></pre></td></tr></table></figure>
<h4 id="例子：-10"><a href="#例子：-10" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">svn</span> <span class="keyword">revert </span>foo.c  &lt;丢弃对一个文件的修改</span><br><span class="line"><span class="symbol">svn</span> <span class="keyword">revert </span>--recursive . &lt;恢复一整个目录的文件，. 为当前目录</span><br></pre></td></tr></table></figure>
<h3 id="17-把工作拷贝更新到别的URL"><a href="#17-把工作拷贝更新到别的URL" class="headerlink" title="17 把工作拷贝更新到别的URL"></a>17 把工作拷贝更新到别的URL</h3><figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn　<span class="keyword">switch</span>　<span class="string">http:</span><span class="comment">//目录全路径　本地目录全路径</span></span><br></pre></td></tr></table></figure>
<h4 id="例子：-11"><a href="#例子：-11" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn switch http:<span class="regexp">//</span>localhost<span class="regexp">/test/</span><span class="number">456</span> . &lt; (原为<span class="number">123</span>的分支)当前所在目录分支到localhost<span class="regexp">/test/</span><span class="number">456</span></span><br></pre></td></tr></table></figure>
<h3 id="18-解决冲突-（冲突可以手动合并的情况）"><a href="#18-解决冲突-（冲突可以手动合并的情况）" class="headerlink" title="18 解决冲突 （冲突可以手动合并的情况）"></a>18 <strong>解决冲突</strong> （冲突可以手动合并的情况）</h3><figure class="highlight accesslog"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn　resolved　<span class="string">[本地目录全路径]</span></span><br></pre></td></tr></table></figure>
<h4 id="例子：-12"><a href="#例子：-12" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">$ svn update</span><br><span class="line">C foo.c</span><br><span class="line">Updated to revision <span class="number">31</span>.</span><br><span class="line"><span class="comment">//如果你在更新时得到冲突，你的工作拷贝会产生三个新的文件：</span></span><br><span class="line">$ ls</span><br><span class="line">foo.c</span><br><span class="line">foo<span class="selector-class">.c</span><span class="selector-class">.mine</span></span><br><span class="line">foo<span class="selector-class">.c</span><span class="selector-class">.r30</span></span><br><span class="line">foo<span class="selector-class">.c</span><span class="selector-class">.r31</span></span><br><span class="line"><span class="comment">//当你解决了foo.c的冲突，并且准备提交，运行svn resolved让你的工作拷贝知道你已经完成了所有事情。</span></span><br><span class="line"><span class="comment">//你可以仅仅删除冲突的文件并且提交，但是svn resolved除了删除冲突文件，还修正了一些记录在工作拷贝管理区域的记录数据，所以我们推荐你使用这个命令。</span></span><br></pre></td></tr></table></figure>
<h3 id="19-不checkout而查看输出特定文件或URL的内容"><a href="#19-不checkout而查看输出特定文件或URL的内容" class="headerlink" title="19 不checkout而查看输出特定文件或URL的内容"></a>19 不checkout而查看输出特定文件或URL的内容</h3><figure class="highlight groovy"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn　cat　<span class="string">http:</span><span class="comment">//文件全路径</span></span><br></pre></td></tr></table></figure>
<h4 id="例子：-13"><a href="#例子：-13" class="headerlink" title="例子："></a>例子：</h4><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">svn cat http:<span class="regexp">//</span>localhost<span class="regexp">/test/</span>readme.txt</span><br></pre></td></tr></table></figure>
<h3 id="20-新建一个分支copy"><a href="#20-新建一个分支copy" class="headerlink" title="20 新建一个分支copy"></a>20 新建一个分支copy</h3><figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">svn</span> copy <span class="keyword">branchA </span><span class="keyword">branchB </span> -m <span class="string">"make B branch"</span> // 从<span class="keyword">branchA拷贝出一个新分支branchB</span></span><br></pre></td></tr></table></figure>
<h3 id="21-合并内容到分支merge"><a href="#21-合并内容到分支merge" class="headerlink" title="21 合并内容到分支merge"></a>21 合并内容到分支merge</h3><figure class="highlight armasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="symbol">svn</span> merge <span class="keyword">branchA </span><span class="keyword">branchB </span> // 把对<span class="keyword">branchA的修改合并到分支branchB</span></span><br></pre></td></tr></table></figure>
        
            <div class="donate-container">
    <div class="donate-button">
        <button id="donate-button">赞赏</button>
    </div>
    <div class="donate-img-container hide" id="donate-img-container">
        <img id="donate-img" src="" data-src="/img/donate.jpg">
        <p> 感谢鼓励 </p>
    </div>
</div>
        
        <div id="comment-container">
        </div>
    </div>
</div>
    </div>
</div>

<footer class="footer">
    <ul class="list-inline text-center">
        
        

        
        <li>
            <a target="_blank" href="http://weibo.com/5216026690">
                            <span class="fa-stack fa-lg">
                                  <i class="iconfont icon-weibo"></i>
                            </span>
            </a>
        </li>
        

        
        <li>
            <a target="_blank" href="https://www.facebook.com/853788089@qq.com">
                            <span class="fa-stack fa-lg">
                                <i class="iconfont icon-facebook"></i>
                            </span>
            </a>
        </li>
        

        
        <li>
            <a target="_blank"  href="https://gitee.com/dh1992">
                            <span class="fa-stack fa-lg">
                                <i class="iconfont icon-github"></i>
                            </span>
            </a>
        </li>
        

        

    </ul>
    
    <p>
        <span>/</span>
        
        <span><a href="https://www.baidu.com">baidu</a></span>
        <span>/</span>
        
        <span><a href="#">Duheng&#39;s Page</a></span>
        <span>/</span>
        
        <span><a href="#">It helps SEO</a></span>
        <span>/</span>
        
    </p>
    
    
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = "search.json"
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="/js/index.js"></script>
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<script src="/js/gitment.js"></script>
<script>
    var gitment = new Gitment({
        id: 'svn 常用操作命令',
        owner: 'aircloud',
        repo: 'hexo-aircloud-blog',
        oauth: {
            client_id: 'your-id-created-by-https://github.com/settings/applications/new',
            client_secret: 'your-secret-created-by-https://github.com/settings/applications/new',
        },
    })
    gitment.render('comment-container')
</script>

</html>
